﻿#region

using System;
using System.Collections.Generic;
using BusinessObjects;
using DataAccessLayer;

#endregion

namespace BusinessLogicLayer
{
    public static class DriverBLL
    {
        /// <summary>
        ///     Register a driver
        /// </summary>
        /// <param name="staffId">Represent's the staff id</param>
        /// <param name="licenseNo">Represent's the license number</param>
        public static void RegisterDriver(int staffId, string licenseNo)
        {
            var driver = new Driver
            {
                StaffId = staffId,
                LicenseNo = licenseNo
            };

            DriverDAL.RegisterDriver(driver);
        }

        /// <summary>
        ///     Get All drivers
        /// </summary>
        /// <returns>All drivers</returns>
        public static List<Driver> GetAllDrivers()
        {
            return DriverDAL.GetAllDrivers();
        }

        /// <summary>
        ///     Edit driver's details
        /// </summary>
        /// <param name="staffId">Represent's the staff id</param>
        /// <param name="licenseNo">Represent's the license number</param>
        public static void EditDriver(int staffId, string licenseNo)
        {
            var driver = new Driver
            {
                StaffId = staffId,
                LicenseNo = licenseNo
            };

            DriverDAL.EditDriver(driver);
        }

        /// <summary>
        ///     Get driver's license number
        /// </summary>
        /// <param name="staffId">Represent's the staff Id</param>
        /// <returns>License number</returns>
        public static string GetLicenceNo(int staffId)
        {
            return DriverDAL.GetLicenceNo(staffId);
        }

        /// <summary>
        ///     Get All drivers by subsidiaryId
        /// </summary>
        /// <returns>All drivers</returns>
        public static List<Driver> GetAllDrivers(byte subsidiaryId)
        {
            return DriverDAL.GetAllDrivers(subsidiaryId);
        }

        /// <summary>
        ///     Set driver's availability (True / False)
        /// </summary>
        /// <param name="driverId">Represent's the driver's Id</param>
        /// <param name="status">Represent's the driver's availability</param>
        public static void SetAvailability(int driverId, bool status)
        {
            Driver driver = new Driver
            {
                StaffId = driverId,
                Availability = status
            };

            DriverDAL.SetAvailability(driver);
        }

        /// <summary>
        ///     Get All available drivers for booking by subsidiaryId
        /// </summary>
        /// <param name="subsidiaryId">Represent's the subsidiary id</param>
        /// <param name="pickupDateTime">Represent's the pickup date and time</param>
        /// <returns>All drivers</returns>
        public static List<Driver> GetAllDrivers(byte subsidiaryId, DateTime pickupDateTime)
        {
            return DriverDAL.GetAllDrivers(subsidiaryId, pickupDateTime);
        }
    }
}